<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}"  media="all">
    <script th:src="@{/jquery/jquery-3.3.1.js}" type="text/javascript"></script>
    <script th:src="@{/layui/layui.js}" type="text/javascript"></script>
    <title>用户中心</title>
    <style>
        /*css*/
    </style>
</head>
<body style="margin-left:20px;">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>用户中心</legend>
</fieldset>
<a class="layui-btn layui-btn-primary layui-btn-sm" th:href="@{/users/insert}"><i class="layui-icon"></i></a>
<table class="layui-table" lay-even="" lay-skin="row">
    <thead>
    <tr>
        <th>姓名</th>
        <th>密码</th>
        <th>年龄</th>
        <th>头像</th>
        <th>加入时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="u:${Users.records}">
        <td th:text="${u.name}"></td>
        <td th:text="${u.password}"></td>
        <td th:text="${u.age}"></td>
        <td><img th:if="${u.headimage!=null}" th:src="${u.headimage}"></td>
        <td th:text="${#dates.format(u.createtime,'yyyy-MM-dd HH:mm:ss')}"></td>
        <td>
            <!--<button class="layui-btn layui-btn-primary layui-btn-sm" th:onclick="'edit('+${u.id}+')'"><i class="layui-icon"></i></button>-->
            <a class="layui-btn layui-btn-primary layui-btn-sm" th:href="@{/users/edit/{id}(id=${u.id})}"><i class="layui-icon"></i></a>
            <a class="layui-btn layui-btn-primary layui-btn-sm" th:href="@{/users/delete/{id}(id=${u.id})}"><i class="layui-icon"></i></a>
            <button class="layui-btn layui-btn-primary layui-btn-sm" type="button" th:onclick="'openconfig('+${u.id}+')'">分配</button>
        </td>
    </tr>
    </tbody>
</table>
<!-- 获取basepath url ajax使用 -->
<span th:include="fragments/basepath::html"></span>
<!-- 获取basepath url ajax使用 -->
<!--分页引入-->
    <div th:replace="common/fenye::html"></div>
    </body>
    <!--分页专用js-->
    <script th:inline="javascript">
        var UsersPage = [[${Users}]];
        fenye(UsersPage,"/users/getAll");
    </script>
    <!--分页专用js-->
<!--分页引入-->

<script th:inline="javascript">
    var baseUrl = getBaseUrl();
    layui.use('layer', function(){
        var layer = layui.layer;
    });
        function openconfig(id){
            layer.open({
                type:2,
                title: '分配权限'
                ,area: ['70%', '60%']
                ,content: baseUrl+'/users/userconfig?id='+id
            });
        }
    </script>
</html>